package com.sun.framework.controller;

import com.sun.common.pojo.*;
import com.sun.framework.service.SsqDataService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/ssq/filter")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SsqFilterController {
    private final SsqDataService ssqService;

    // http://localhost:8888/ssq/queryCombinationByCondition
    // 根据条件获取组合
    @PostMapping("/queryCombinationByCondition")
    public Result<List<SsqVo>> queryCombinationByCondition(@RequestBody SsqQuery ssqQuery) {
        long startTime = System.currentTimeMillis();
        List<SsqVo> result = ssqService.queryCombinationByCondition(ssqQuery);
        log.info("count：{} time：{}", result.size(), (System.currentTimeMillis() - startTime));
        return new Result<>(result);
    }

}
